package jvm;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Unsafe {
    public static void main(String[] args) throws InstantiationException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        Field declaredField = sun.misc.Unsafe.class.getDeclaredFields()[0];
        declaredField.setAccessible(true);
        sun.misc.Unsafe unsafe = (sun.misc.Unsafe) declaredField.get(null);
        String instance =(String) unsafe.allocateInstance(String.class);

        System.out.println(instance.getClass().getName());
        System.out.println(instance);
    }
}
